package com.chenyi.file.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * 读取阿里云上传相关配置
 *
 * @author wangkh
 */
@Component
@ConfigurationProperties(prefix = "file.oss")
@PropertySource(value = { "classpath:plugin-file.yml"} , encoding="UTF-8")
public class FileOssConfig {

    private static String endpoint;

    private static String accessKeyId;

    private static String accessKeySecret;

    private static String bucketName;

    public static String getEndpoint() {
        return endpoint;
    }

    @Value("${endpoint}")
    public  void setEndpoint(String endpoint) {
        FileOssConfig.endpoint = endpoint;
    }

    public static String getAccessKeyId() {
        return accessKeyId;
    }

    @Value("${accessKeyId}")
    public void setAccessKeyId(String accessKeyId) {
        FileOssConfig.accessKeyId = accessKeyId;
    }

    public static String getAccessKeySecret() {
        return accessKeySecret;
    }

    @Value("${accessKeySecret}")
    public void setAccessKeySecret(String accessKeySecret) {
        FileOssConfig.accessKeySecret = accessKeySecret;
    }

    public static String getBucketName() {
        return bucketName;
    }

    @Value("${bucketName}")
    public  void setBucketName(String bucketName) {
        FileOssConfig.bucketName = bucketName;
    }
}
